<?php
	// If Process type is PREVIEW/EDIT/DELETE, Get All variables needed to be displayed by form, Edit SQL & Variable if necessary !!!
	if($process_type == "PREVIEW" || $process_type == "EDIT" || $process_type == "DELETE")
	{
		$sql2 = "select * from ms_module_sub where stsrc = 'A' and modulesubid = '".$PK_id."' ";
		$exe2 = mysql_query($sql2) or die(mysql_error());
		$num2 = mysql_num_rows($exe2);
		$row2 = mysql_fetch_array($exe2);
		
		// Set Value if data is found
		if($num2>0)
		{
			$val_modules_sub_PK_id = $row2['modulesubid'];
			$val_modules_sub_parent_id = $row2['moduleid'];
			$val_modules_sub_name = $row2['modulesubname'];
			$val_modules_sub_label = $row2['modulesublabel'];
			$val_modules_sub_front = $row2['modulesuburlfront'];
			$val_modules_sub_back = $row2['modulesuburlback'];
			$val_modules_sub_position = $row2['modulesubposition'];
			$val_modules_sub_activate = $row2['modulesubstatus'];
		}
		else
		{
			$val_modules_sub_PK_id = "";
			$val_modules_sub_parent_id = "";
			$val_modules_sub_name = "";
			$val_modules_sub_label = "";
			$val_modules_sub_front = "";
			$val_modules_sub_back = "";
			$val_modules_sub_position = "";
			$val_modules_sub_activate = "";
		}
	}
	else
	{
		$val_modules_sub_PK_id = "";
		$val_modules_sub_parent_id = "";
		$val_modules_sub_name = "";
		$val_modules_sub_label = "";
		$val_modules_sub_front = "";
		$val_modules_sub_back = "";
		$val_modules_sub_position = "";
		$val_modules_sub_activate = "";
	}
	
?>
<!-- Start Row Data -->
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Parent</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
			<?php
				$sql3 = "select moduleid, modulename, modulelabel from ms_module where stsrc = 'A' ";
				$exe3 = mysql_query($sql3) or die(mysql_error());
				$num3 = mysql_num_rows($exe3);
				
				if($num3 > 0)
				{
			?>
			<select <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> name="txt_submodules_parent">
				<?php if($process_type == "ADD"){ ?><option value="-1" >Select Parent !</option><?php } ?>
				<?php
					
					
					while($row3 = mysql_fetch_array($exe3))
					{
				?>
				<option <?php if($row3['moduleid'] == $val_modules_sub_parent_id){echo "selected=selected";} ?> value="<?php echo $row3['moduleid']; ?>" ><?php echo ucwords(strtolower($row3['modulename']))." - ".ucwords(strtolower($row3['modulelabel'])); ?></option>
				<?php
					}
				?>
			</select>
			<?php
				}
				else
				{
			?>
				<span style="color:#FF0000;">No Data !</span>
			<?php
				}
			?>
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Name</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" type="text" name="txt_submodules_name" value="<?php echo $val_modules_sub_name; ?>" />
		<input <?php if($_SESSION['usergroupid'] != 1 || $process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_submodules_name" value="<?php echo $val_modules_sub_name; ?>" style="width:200px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Label</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_submodules_label" value="<?php echo $val_modules_sub_label; ?>" style="width:200px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Front URL</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" type="text" name="txt_submodules_front" value="<?php echo $val_modules_sub_front; ?>" />
		<input <?php if($_SESSION['usergroupid'] != 1 || $process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_submodules_front" value="<?php echo $val_modules_sub_front; ?>" style="width:200px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Back URL</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" type="text" name="txt_submodules_back" value="<?php echo $val_modules_sub_back; ?>" />
		<input <?php if($_SESSION['usergroupid'] != 1 || $process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_submodules_back" value="<?php echo $val_modules_sub_back; ?>" style="width:200px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Position</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="number" required min="1" max="100" name="txt_submodules_position" value="<?php echo $val_modules_sub_position; ?>" style="width:50px; height:18px; font-size:10px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Activate</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" name="txt_submodules_PK_id" value="<?php echo $val_modules_sub_PK_id; ?>" style="width:200px; height:18px;" />
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="radio" name="rdo_submodules_activate" value="1" <?php if(isset($val_modules_sub_activate)){if($val_modules_sub_activate == 1){echo "checked='true'";}} ?> /> Yes
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="radio" name="rdo_submodules_activate" value="0" <?php if(isset($val_modules_sub_activate)){if($val_modules_sub_activate == 0){echo "checked='true'";}} ?> /> No
	</div>
	<div style="clear:both;"></div>
</div>
<!-- End Row Data -->